/**
 * 
 */
package org.cuatrovientos.erp.business;

import java.util.List;

import org.apache.log4j.Logger;
import org.cuatrovientos.erp.dao.CurrencyDAOInterface;
import org.cuatrovientos.erp.model.Currency;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author eneko_lana
 * This class implements CurrencyBOInterface
 */
public class CurrencyBO implements CurrencyBOInterface{
	// Get log4j logger
		private static final Logger logger = Logger.getLogger(CurrencyBO.class);
		
		@Autowired
	    private CurrencyDAOInterface CurrencyDAO;
		
	/**
	 * @param int id
	 * @return Currency Currency
	 * This method returns a Currency selected by it's id
	 */
	@Override
	public Currency selectById(int id) {
		logger.info("selectById: " + id);
		return CurrencyDAO.selectById(id);
	}
	
	/**
	 * @return All the countries we have in the database
	 */
	@Override
	public List<Currency> selectAll() {
		logger.info("selectAll: ");
		return CurrencyDAO.selectAll();
	}
	
	/**
	 * @return The number of countries we have in the database
	 */
	@Override
	public List<Currency> search(String name) {
		logger.info("search : " + name);
		return CurrencyDAO.search(name);
	}
	
	/**
	 * @param int id
	 * This method deletes the Currency selected by id
	 */
	@Override
	public void deleteById(int id) {
		logger.info("delete by: " + id + " id");
		CurrencyDAO.deleteById(id);
	}
	
	/**
	 * @param Currency Currency
	 * This method insert a Currency in the database passed by parameter
	 */
	@Override
	public void insert(Currency Currency) {
		logger.info("insert: " + Currency);
		CurrencyDAO.insert(Currency);
	}
	
	/**
	 * @param Currency Currency
	 * This method updates a Currency passed by parameter
	 */
	@Override
	public void update(Currency Currency) {
		logger.info("update: " + Currency);
		CurrencyDAO.update(Currency);
	}
	
	/**
	 * @param Currency role
	 * This method deletes a Currency passed by parameter
	 */
	@Override
	public void delete(Currency Currency) {
		logger.info("delete: " + Currency);
		CurrencyDAO.delete(Currency);
	}

}
